package com.zgz.underwrite.action;

import com.zgz.underwrite.dao.EmployeeDao;
import com.zgz.underwrite.model.Employee;

public class LoginAction extends BaseAction{

	/**
	 * 
	 */
	private static final long serialVersionUID = 8507247635496817205L;

	Employee emp;
	EmployeeDao empDao;
	
	public String login(){
		Employee user = null;
		try {
			user = this.empDao.get(emp.getSEmpCde());
		} catch (Exception e) {
			e.printStackTrace();
		}
		if(user != null){
			if(user.getSPassword().equals(emp.getSPassword())){
				super.request.getSession().setAttribute("user", user);
				return SUCCESS;
			}
		}
		return ERROR;
	}
	
	
	public Employee getEmp() {
		return emp;
	}

	public void setEmp(Employee emp) {
		this.emp = emp;
	}

	public EmployeeDao getEmpDao() {
		return empDao;
	}

	public void setEmpDao(EmployeeDao empDao) {
		this.empDao = empDao;
	}
}
